﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using BusinessObjects.BO_GetObjects;

/// <summary>
/// Summary description for Articles_Order
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class Order : System.Web.Services.WebService
{

    public Order()
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
    [WebMethod]
    public bool articles(string id, int mid)
    {
        try
        {
            string str = String.Empty;
            string[] ids = id.Split(new string[] { "&table-3[]=" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string per in ids)
            {
                str += per + ";";
            }
            bool a = BO_Articles.Order(mid, str);
            return a;
        }
        catch { return false; }
    }
    [WebMethod]
    public bool sec_admin_modules(string id)
    {
        try
        {
            string str = String.Empty;
            string[] ids = id.Split(new string[] { "&table-3[]=" }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = ids.Length; i > 0; i--)
            {
                str += ids[i - 1] + ";";
            }
            bool a = BO_Sec_Admin_Modules.Order(str, ";", 1);
            return a;
        }
        catch { return false; }
    }
    [WebMethod]
    public bool modules(string id, int l_id, int c_id)
    {
        try
        {
            string str = String.Empty;
            string[] ids = id.Split(new string[] { "&table-3[]=" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string per_id in ids)
                str += per_id + ";";
            return BO_Module.Order(c_id + ":" + l_id, str, ":", ";");
        }
        catch { return false; }
    }
    [WebMethod]
    public bool categories(string id)
    {
        try
        {
            string str = String.Empty;
            string[] ids = id.Split(new string[] { "&table-3[]=" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = ids.Length; i > 0; i--)
            {
                str += ids[i - 1] + ";";
            }
            bool a = BO_Categories.Order(str, ";", 1);
            return a;
        }
        catch { return false; }
    }
}
